package org.academiadecodigo.carcrash.cars;

public class CarFactory {

    public static Car getNewCar() {

        CarType newType = CarType.values()[(int) (Math.random() * CarType.values().length)];
        switch (newType) {
            case PORSCHE:
                return new Porsche();
            case FERRARI:
                return new Ferrari();
            default:
                return new Beetle();
        }
    }
}
